package com.tyk.bookstore.front.payment.strategy.enume;

import com.fasterxml.jackson.annotation.JsonValue;
import com.tyk.bookstore.front.common.core.model.enume.BaseEnum;
import com.tyk.bookstore.front.payment.strategy.PayAction;
import com.tyk.bookstore.front.payment.strategy.impl.AliPayAction;
import com.tyk.bookstore.front.payment.strategy.impl.LocalPayAction;
import com.tyk.bookstore.front.payment.strategy.impl.WeChatPayAction;

/**
 * @author tyk
 * @description PayType
 */
public enum PayType implements BaseEnum {
    /**
     * 商城余额
     */
    LOCAL(0, LocalPayAction.class),
    /**
     * 支付宝
     */
    ALIPAY(1, AliPayAction.class),
    /**
     * 微信支付
     */
    WE_CHAT(2, WeChatPayAction.class);

    @JsonValue
    private final Integer code;

    private final Class<? extends PayAction<?>> clazz;


    @Override
    public Integer value() {
        return this.code;
    }

    PayType(Integer code, Class<? extends PayAction<?>> clazz) {
        this.code = code;
        this.clazz = clazz;
    }

    public String getClassName() {
        return this.clazz.getSimpleName();
    }

}
